package com.sds.shop.action;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import com.sds.fw.mvc.Action;
import com.sds.fw.mvc.HttpUtil;

import com.sds.shop.dao.MemDAO;
import com.sds.shop.vo.MemVO;


public class UserModifyFormAction extends Action {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		request.setCharacterEncoding("euc-kr");
		
		String id = request.getParameter("id");
		String name = request.getParameter("name");
		String pw = request.getParameter("pw");
		String pwh = request.getParameter("pwh");
		String pwa = request.getParameter("pwa");
		String ssn = request.getParameter("ssn");
		String birth = request.getParameter("birth");
		String maleflg = request.getParameter("maleflg");
		String telno = request.getParameter("telno");
		String celno = request.getParameter("cellno");
		String addr = request.getParameter("addr");
		String email = request.getParameter("email");
		String emailrcvflg = request.getParameter("emailrcvflg");
	
		MemVO vo = new MemVO();
		System.out.println(id);
		System.out.println(name);
		System.out.println(pw);
		System.out.println(addr);
		
		vo.setMemId(id);
		vo.setMemNm(name);
		vo.setPwd(pw);
		vo.setPwdHint(pwh);
		vo.setPwdHintAns(pwa);
		vo.setSsn(ssn);
		vo.setBirthDt(birth);
		vo.setMaleFlg(maleflg);
		vo.setTelNo(telno);
		vo.setCellNo(celno);
		vo.setAddr(addr);
		vo.setEmail(email);
		vo.setEmailRcvFlg(emailrcvflg);
		
		
		MemDAO dao = new MemDAO();
		dao.modifyUser(vo);
		
		System.out.println("db update success.");
		HttpUtil.redirect(response, "list.do");
	}

}
